import { S } from '../../s';
import { IPSAppCounterRef } from '../../app/control/ipsapp-counter-ref';
import { IPSAppViewUIAction } from '../../app/view/ipsapp-view-uiaction';
import { IPSSysPanelButton } from './ipssys-panel-button';
import { PSSysPanelItemImpl } from './pssys-panel-item-impl';
import { IPSUIAction } from '../../view/ipsuiaction';

export class PSSysPanelButtonImpl
  extends PSSysPanelItemImpl
  implements IPSSysPanelButton
{
  get actionType():
    | 'NONE'
    | 'UIACTION'
    | 'UILOGIC'
    | 'OPENVIEW'
    | 'OPENDEVIEW'
    | 'OPENSYSPDTVIEW'
    | 'OPENHTMLPAGE'
    | 'DATA_CREATEOBJECT'
    | 'DATA_SAVECHANGES'
    | 'DATA_CANCELCHANGES'
    | 'DATA_REMOVEOBJECT'
    | 'DATA_SYNCHRONIZE'
    | 'VIEW_OKACTION'
    | 'VIEW_CANCELACTION'
    | 'VIEW_YESACTION'
    | 'VIEW_NOACTION'
    | 'UTIL_ADDSELECTION'
    | 'UTIL_REMOVESELECTION'
    | 'UTIL_ADDALL'
    | 'UTIL_REMOVEALL'
    | 'UTIL_PREVSTEP'
    | 'UTIL_NEXTSTEP'
    | 'UTIL_FINISH'
    | 'UTIL_SEARCH'
    | 'UTIL_RESET'
    | 'APP_LOGIN'
    | 'APP_LOGOUT'
    | 'CUSTOM' {
    return this.M.actionType;
  }

  get borderStyle(): string {
    return this.M.borderStyle;
  }

  get buttonCssStyle(): string {
    return this.M.buttonCssStyle;
  }

  get buttonHeight(): number {
    return this.M.buttonHeight != null ? this.M.buttonHeight : 0.0;
  }

  get buttonStyle(): string {
    return this.M.buttonStyle;
  }

  get buttonType(): string {
    return this.M.buttonType || 'PANELBUTTON';
  }

  get buttonWidth(): number {
    return this.M.buttonWidth != null ? this.M.buttonWidth : 0.0;
  }

  get captionItemName(): string {
    return this.M.captionItemName;
  }

  get cssStyle(): string {
    return this.M.cssStyle;
  }

  get iconAlign(): 'LEFT' | 'TOP' | 'RIGHT' | 'BOTTOM' {
    return this.M.iconAlign;
  }

  protected psappcounterref: IPSAppCounterRef;
  getPSAppCounterRef(): IPSAppCounterRef | null {
    return (
      this.psappcounterref ||
      (this.psappcounterref = this.fillObjectModel(
        S._9d,
        this.M.getPSAppCounterRef,
        S._2a9,
      ) as IPSAppCounterRef)
    );
  }

  protected psappviewuiaction: IPSAppViewUIAction;
  getPSAppViewUIAction(): IPSAppViewUIAction | null {
    return (
      this.psappviewuiaction ||
      (this.psappviewuiaction = this.fillObjectModel(
        S._8e,
        this.M.getPSAppViewUIAction,
        S._2da,
      ) as IPSAppViewUIAction)
    );
  }

  protected psuiaction: IPSUIAction;
  getPSUIAction(): IPSUIAction | null {
    return (
      this.psuiaction ||
      (this.psuiaction = this.fillObjectModel(
        S._29d,
        this.M.getPSUIAction,
        S._2de,
      ) as IPSUIAction)
    );
  }

  get renderMode(): 'BUTTON' | 'LINK' {
    return this.M.renderMode || 'BUTTON';
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  get uIActionParamJO(): IModel {
    return this.M.uIActionParamJO;
  }

  get uIActionTarget():
    | 'SINGLEDATA'
    | 'SINGLEKEY'
    | 'MULTIDATA'
    | 'MULTIKEY'
    | 'NONE' {
    return this.M.uIActionTarget;
  }

  get xDataControlName(): string {
    return this.M.xDataControlName;
  }

  get saveTargetFirst(): boolean {
    return this.M.saveTargetFirst != null ? this.M.saveTargetFirst : false;
  }
  get cls(): string {
    return 'PSSysPanelButtonImpl';
  }
  instanceof(cls: string): boolean {
    if (
      cls == S._8e ||
      cls == S._af ||
      cls == S._3ac ||
      cls == S._17e ||
      cls == S._17f
    )
      return true;
    return super.instanceof(cls);
  }
}
